package com.liufei1988.features;

/**
 * https://www.cnblogs.com/secbro/p/12550347.html
 */
public class Switch {

    public static void testSwitchJava14Before(Day day){
        switch (day){
            case MONDAY:
            case FRIDAY:
            case SUNDAY:
                System.out.println(6);
                break;
            case TUESDAY:
                System.out.println(7);
                break;
            case THURSDAY:
            case SATURDAY:
                System.out.println(8);
                break;
            case WEDNESDAY:
                System.out.println(9);
                break;

        }
    }

    public static void switchJava14(Day day){
        switch (day) {
            case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
            case TUESDAY                -> System.out.println(7);
            case THURSDAY, SATURDAY     -> System.out.println(8);
            case WEDNESDAY              -> System.out.println(9);
        }
    }

    public static void main(String[] args) {
        testSwitchJava14Before (Day.TUESDAY);
        switchJava14(Day.FRIDAY);
    }

}
enum Day{
    MONDAY,FRIDAY,SUNDAY,TUESDAY,THURSDAY,SATURDAY,WEDNESDAY;
}
